#include <string>

using namespace std;

class Solution {
public:
    // 暴力破解
    int strStr(string haystack, string needle) {
        int m = haystack.size();
        int n = needle.size();
        for (int i = 0; i + n <= m; i++) {
            bool found = true;
            for (int j = 0; j < n; j++) {
                if (haystack[i + j] != needle[j]) {
                    found = false;
                    break;
                }
            }

            if (found) {
                return i;
            }
        }

        return -1;
    }
};